<?php
/**
* 加载系统配置文件
*  
* @copyright	http://www.easymvc.com
* @author 		光哥  <439884988@qq.com>
* @version		1.0 - 2012-03-26
* @package		Frame
* 
*/
class Frame_Config {
    /**
     * 加载文件方法
     * 
     * @param string $key
     * @throws Frame_Exception_Program
     * @return array|string
     */
	public static function get($key){
		static $config;
		if(!isset($config[$key])) {
			@list($file,$arr_key) = explode('.',$key,2);
			$file = BASEPATH . 'htdocs'.DS.'config'. DS . $file . '.php';
			if(file_exists($file)){
				$arr_config = require $file;
			}else{
				throw new Frame_Exception_Program($file ." no exists" );
			}
			if($arr_key){
				$config[$key] = $arr_config[$arr_key];
				if(!isset($config[$key]))  throw new Frame_Exception_Program($key." key no exists" );
			}else{
				$config[$key] = $arr_config;
			}
			
		}
		return $config[$key];
	}

}


?>